﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DataShow.Login" %>


<!DOCTYPE html>
<html class="login-bg">
<head>
    <title>登录</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- bootstrap -->
    <link href="/css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="/css/layout.css" />
    <link rel="stylesheet" type="text/css" href="/css/elements.css" />
    <link rel="stylesheet" type="text/css" href="/css/icons.css" />

    <!-- libraries -->
    <link rel="stylesheet" type="text/css" href="/css/lib/font-awesome.css" />

    <!-- this page specific styles -->
    <link rel="stylesheet" href="/css/compiled/signin.css" type="text/css" media="screen" />

    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
        .box {
            margin: 0 auto;
            height: 230px;
            overflow-y: auto;
        }

        #rank {
            text-decoration: none;
        }

        h4 {
            color: #0088cc;
            font-family: 微软雅黑;
            margin-bottom: 4px;
            font-size: 15px;
        }

        .edit {
            font-size: 10px;
        }
    </style>
</head>
<body onkeydown="if(event.keyCode==13){document.getElementById('btn_login').click()}">
    <form runat="server">
        <div class="row-fluid login-wrapper">
            <div class="row-fluid">
                <div class="span3">
                </div>
                <div class="span6">
                    <div class="row-fluid">
                        <div class="span12" style="margin: 0 auto">
                            <a>
                                <img class="logo" src="/img/logo1.png" style="width: 99%; margin-top: 30px; float: right" alt="点此登录" />
                            </a>
                        </div>
                    </div>
                </div>
                <div class="span3">
                    <a class="btn-link btn" style="color:white;float:right" href="#myModal" role="button" data-toggle="modal"  title="点此登录">点此登录</a>
                </div>
            </div>

            <div class="row-fluid">
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap">
                                    <h6>月气候数据</h6>
                                    <h4 style="text-align: left">
                                        <asp:Label runat="server" ID="lbl_yue" /></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap" id="ranks">
                                    <h6>预报员排名</h6>
                                    <h4 id="o"></h4>
                                    <h4 id="t"></h4>
                                    <h4 id="th"></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap">
                                    <h6>模式排名</h6>
                                    <asp:Label runat="server" ID="lbl_mspm" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row-fluid">
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap">
                                    <h6>旬气候数据</h6>
                                    <h4 style="text-align: left">
                                        <asp:Label runat="server" ID="lbl_xun" /></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap">
                                    <h6>服务重点 </h6>
                                    <h4 style="text-align: center">
                                        <asp:Label runat="server" ID="lbl_fwzd" /><asp:TextBox runat="server" ID="txt_edit" Visible="false" /></h4>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="span4 box">
                                <div class="content-wrap">
                                    <h6>常用业务文件</h6>
                                    <asp:Label runat="server" ID="lbl_files" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">登录</h3>
            </div>
            <div class="modal-body">
                <asp:Label runat="server" ID="lbl_errormsg" />
                <asp:TextBox  placeholder="用户名" runat="server" ID="txt_username" />
                <asp:TextBox  placeholder="密码" runat="server" TextMode="Password" ID="txt_password" />
                
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                <asp:LinkButton ID="btn_login" ClientIDMode="Static" runat="server" Text="登陆" CssClass="btn-glow primary login" OnClick="lb_login_Click" />
            </div>
        </div>
    </form>
    <!-- scripts -->
    <script src="js/jquery-latest.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/theme.js"></script>

    <!-- pre load bg imgs -->
    <script type="text/javascript">
        $(function () {
            // bg switcher
            var $btns = $(".bg-switch .bg");
            $btns.click(function (e) {
                e.preventDefault();
                $btns.removeClass("active");
                $(this).addClass("active");
                var bg = $(this).data("img");

                $("html").css("background-image", "url('img/bgs/" + bg + "')");
            });

        });

        var UserNamePair = [];
        $.ajax({
            type: "GET",
            url: "/CommonHandler.ashx?action=get_name",
            async: false,
            data: {},
            success: function (data) {
                var result = eval(data);
                UserNamePair = result;
            }
        })

        //根据用户名获取名字
        function GetNameByUser(user) {
            for (var i = 0; i < UserNamePair.length; i++) {
                var item = UserNamePair[i];
                if (item.username == user) {
                    return item.name
                }
            }
        }

        $(".box").css("margin", "0 auto").css("margin-bottom", "10px");
        var month = new Date().getMonth() + 1;
        var year = new Date().getFullYear();
        $(function () {
            $.ajax({
                type: "GET",
                url: "/rank/Handler.ashx",
                data: { year: year, month: month },
                success: function (data) {
                    var json = JSON.parse(data);
                    if (json.success == "True") {
                        var postions = json.result.data;
                        for (var i = 0; i < postions.length && i < 3; i++) {
                            var user = postions[i];
                            var Name = GetNameByUser(user.user);
                            if (i == 0) {
                                $("#o").text(Name);
                            } else if (i == 1) {
                                $("#t").text(Name);
                            } else if (i == 2) {
                                $("#th").text(Name);
                            }
                        }
                    }
                    else {
                        alert(json.msg)
                    }
                }
            })
        })

        function CallModal() {
            $("#myModal").modal("show");
        }
        

    </script>
</body>
</html>
